<template>
  <div class="mainBox">
    <div class="btnBox">
      <div class="btnOne">
        <el-select
          v-model="value"
          clearable
          placeholder="Select"
          class="marginRight"
        >
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <el-input
          size="small"
          v-model="input"
          placeholder="会员名称/会员卡/手机号"
          class="marginRight"
        />
        <el-button type="primary">查询</el-button>
      </div>
      <el-button @click="SetupMembershipCard">添加会员卡</el-button>
    </div>
    <div class="tableBox">
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column prop="date" label="Date" width="180" />
        <el-table-column prop="date" label="Date" width="180" />
        <el-table-column prop="date" label="Date" width="180" />
        <el-table-column prop="date" label="Date" width="180" />

        <el-table-column prop="name" label="Name" width="180" />
        <el-table-column prop="address" label="操作">
          <template #default>
            <el-button link type="primary" size="small" @click="toEditor"
              >编辑</el-button
            >
            <el-button link type="primary" size="small" @click="deteleBtn"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref } from "vue";
import router from "../../router";
import { ElMessage, ElMessageBox } from "element-plus";
const value = ref("");
const input = ref("");
const tableData = [
  {
    date: "2016-05-03",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
  {
    date: "2016-05-02",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
  {
    date: "2016-05-04",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
  {
    date: "2016-05-01",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
];
const options = [
  {
    value: "Option1",
    label: "Option1",
  },
  {
    value: "Option2",
    label: "Option2",
  },
  {
    value: "Option3",
    label: "Option3",
  },
  {
    value: "Option4",
    label: "Option4",
  },
  {
    value: "Option5",
    label: "Option5",
  },
];
const SetupMembershipCard: any = function () {
  router.push("/mainView/MembershipCard/shipcardTwoBox/shipAdd");
};
const toEditor: any = function () {
  router.push("/mainView/MembershipCard/shipcardTwoBox/shipcardTwoOne");
};
//删除
const deteleBtn = () => {
  ElMessageBox.confirm("确定删除吗？删除后无法找回！！", "Warning", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      ElMessage({
        type: "success",
        message: "删除成功",
      });
    })
    .catch(() => {
      ElMessage({
        type: "info",
        message: "删除失败",
      });
    });
};
</script>

<style scoped>
.mainBox {
  width: 100%;
  padding: 15px 20px;
  box-sizing: border-box;
  background-color: #fff;
}
.btnBox {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-content: center;
}
.btnOne {
  display: flex;
}
.marginRight {
  margin-right: 15px;
}
.tableBox {
  width: 100%;
  margin-top: 20px;
}
</style>
